#!/usr/bin/env python
# -*- coding:utf-8 -*-

import requests
from bs4 import BeautifulSoup

r = requests.get('https://python123.io/ws/demo.html')
demo = r.text
soup = BeautifulSoup(demo, 'html.parser')
#print(soup.prettify())

#print(soup.head.contents)
#print(soup.body.contents)
#print(soup.title.parent)
#print(soup.html.parent)
#for a in soup.a.parents:
#    if a is None:
#        print('->', a)
#    else:
#        print(a.name)
#print(soup.a.next_sibling)
#print(soup.a.next_sibling.next_sibling)
for i in soup.a.next_siblings:
    print(i)